/*
 * CamDemo.h
 *
 *  Created on: 10 Nov 2012
 *      Author: hopey
 */

#ifndef CAMDEMO_H_
#define CAMDEMO_H_
#include "OpenLidDemo.h"
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "../filters/Filters.h"
#include "../gui/MatWidget.h"
#include <gtkmm/box.h>

const int FRAMERATE = 10; //TODO: reading command line args, config files.
using namespace std;
namespace openlid {

class CamDemo : public OpenLidDemo {
public:
	CamDemo(int argc, char** argv);
	virtual ~CamDemo();
protected:
	unique_ptr<Gtk::Window> create_components() override;

private:
	bool timer_callback();
	//Gtk::VBox box;
	MatWidget beforeWidget;
	MatWidget afterWidget;
	MatWidget spareWidget;

	/*
	 * We never refer to these, but need to hold onto them to stop the data being garbage collected.
	 * There could be a better way, such as manually incrementing/decrementing the reference count
	 *
	 */
	cv::Mat beforeMat;
	cv::Mat afterMat;
	cv::Mat spareMat;

	sigc::connection timerConnection;
	cv::VideoCapture webcam;
	shared_ptr<FilterChain> filterChain;
	//FilterChain filterChain;
	//FilterChain filterChain2; //Sorry!

};

} /* namespace openlid */
#endif /* CAMDEMO_H_ */
